﻿<%@ Page Language="C#" AutoEventWireup="true" %>
<% 
    if (System.Web.HttpRuntime.Cache["pre_auth_code_expires"] == null)
    {
        weixin.api.WXComponent.GetPreAuthCode();
    }
    if (string.IsNullOrEmpty(Request.QueryString["auth_code"]))
    {
        Response.Redirect(string.Format("https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={0}&pre_auth_code={1}&redirect_uri={2}",
            weixin.api.WXConfig.sAppID,
            System.Web.HttpRuntime.Cache["pre_auth_code"],
            System.Web.HttpUtility.UrlEncode(Request.Url.AbsoluteUri)
        ));
    }
%>